<?php
abstract class SeoVietActiveRecord extends CActiveRecord{
    //prepares create_time, update_time
    //attr before performng validation

    protected function beforeValidate(){
        if ($this->isNewRecord){
            $this->create_time = $this->update_time = new CDbExpression('NOW()');
            //the above statement works with mysql

            //FOR DIFF DATABASE, USE THIS STATEMENT
            //$this->createTime=$this->updateTime=date( 'Y-m-d H:i:s', time() );

        }
        else{
            $this->update_time = new CDbExpression('NOW()');
        }
        return parent::beforeValidate();
    }
}

?>
